package com.zjy.weather.adapter

import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter

/**
 * Created by zhongjy on 2017/11/2.
 * Copyright (C) 2017 zhongjy. All rights reserved.

 */
class FragmentAdapter<T : Fragment>(fm: FragmentManager, private val mFragments: List<T>?) : FragmentPagerAdapter(fm) {

    override fun getCount(): Int {
        return mFragments?.size ?: 0
    }

    override fun getItem(arg0: Int): Fragment? {
        return if (mFragments == null) null else mFragments[arg0]
    }

}